<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            *{
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
            h1{
                color: #f60;
                text-align: center;
            }
            div{
                background-color: aquamarine;
                display: block;
                margin: 10px auto;
                width: 800px;
                height: 40px;
            }
            .send{
                width: 50px;
                line-height: 40px;
                float: right;
                background-color: #f60;
                color: white;
                outline: none;
                cursor: pointer;
                border: none;
            }
            .close{
                width: 50px;
                line-height: 40px;
                background-color: #f60;
                color: white;
                outline: none;
                cursor: pointer;
                border: none;
                float: left;
            }
            textarea{
                width: 800px;
                outline: none;
                display: block;
                margin: 20px auto;
                resize: none;
            }
            ul{
                width: 800px;
                margin: 30px auto;
            }
            li{
                border: 1px solid #f60;
                position: relative;
                padding: 20px;
                margin: 25px auto;
            }
            span{
                right: -5px;
                top: -5px;
                position: absolute;
                cursor: pointer;
            }
        </style>
    </head>
    <body>
        <h1>微博</h1>

        <div>
            <button class="close">取消</button>
            <button class="send" id="btn">发送</button>
        </div>
        <textarea name="" id="txt" cols="30" rows="10"></textarea>
        <!-- <button id="btn">发送</button> -->
        
        <ul id="box">
            <li>
                儿童
            <p>dasdsa</p>
            <span onclick="delet(this)"><img src="2.jpg" alt="" width="20px"></span>
            </li>
        </ul>
        

        <script>
            var txt = document.getElementById('txt');
            var btn = document.getElementById("btn");
            var box = document.getElementById('box');

            var year = new Date().getFullYear();
            var month = new Date().getMonth()+1;
            var date = new Date().getDate();


            btn.onclick=function(){
                var value = txt.value;
                if(value != ''){
                    var tag = document.createElement('li');
                    tag.innerHTML=`${value}<p>${year}-${month}-${date}</p><span onclick="delet(this)"><img src="2.jpg" alt="" width="20px"></span>`;
                    box.appendChild(tag);
                } 
            }

            function delet(a){
                    a.parentNode.parentNode.removeChild(a.parentNode);
                }
        </script>
    </body>
</html>